<%@ taglib prefix="page" uri="http://com.qipay/pagelib" %>
<%@ page language="java" import="com.qipay.admin.manager.vo.OperateLogDTO" contentType="text/html;charset=utf-8" %>
<%@ page import="com.qipay.admin.tags.PageModel" %>
<%@ page import="com.qipay.admin.utils.SiteHelper" %>
<%@ page import="com.qipay.user.entity.UserLevel" %>
<%@ page import="java.util.Iterator" %>
<%@ page import="java.util.List" %>
<!doctype html>
<html>
<head>
    <meta name="viewport"
          content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <jsp:include page="head.jsp"></jsp:include>
    <link rel="stylesheet" href="<%= request.getAttribute("StaticHost") %>/css/dataTables.bootstrap.min.css">
    <link rel="stylesheet" href="<%= request.getAttribute("StaticHost") %>/css/list.css">
    <script type="text/javascript">
        //document.getElementsByTagName("html")[0].style.width=screen.availWidth/100+"px";
        document.getElementsByTagName("html")[0].style.fontSize=screen.availWidth/200+"px";
    </script>
    <style type="text/css">
        .border{
            border:1px solid red;
        }
    </style>
</head>
<body class="devpreview hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <jsp:include page="nav.jsp"></jsp:include>
    <jsp:include page="left.jsp"></jsp:include>
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <div class="col-md-12">
                    <div class="box border" >
                        <div class="box-header">
                            <h3 class="box-title">系统日志列表</h3>
                        </div>
                        <div class="new-group">
                                <label> 日志类别：</label>
                                <select id="ddltype" name="type">
                                    <option value="1">全部</option>
                                    <option value="login">登录</option>
                                    <option value="cp">商户</option>
                                    <option value="proxy">代理商</option>
                                    <option value="order">订单</option>
                                    <option value="withdraw">提现</option>
                                    <option value="sys">系统</option>
                                    <option value="doc">文档</option>
                                    <option value="statement">统计</option>
                                </select>
                        </div>
                        <div class="new-group">
                                <label> 登录账号：</label>
                            <input type="text" id="txtPerson" value="<%= request.getParameter("uid")!=null?request.getParameter("uid"):""%>"/>
                        </div>
                                <button type="button" class="button back-green" >查询</button>
                        <!-- /.box-header -->
                        <div class="tableContent">
                            <table class="table table-bped table-hover">
                                <thead>
                                <tr>
                                    <th width="6%">ID</th>
                                    <th width="8%">账号</th>
                                    <th width="10%">IP</th>
                                    <th width="10%">操作内容</th>
                                    <th width="10%">操作时间</th>
                                    <th width="18%">详情</th>

                                </tr>
                                </thead>
                                <tbody>
                                <% List<OperateLogDTO> articles = (List<OperateLogDTO>) request.getAttribute("lst");
                                    PageModel pager = (PageModel) request.getAttribute("page");
                                    String query = pageContext.getRequest().getServletContext().getContextPath() + "/sys/log" + pager.getUrl();
                                    if (articles != null && articles.size() > 0) {
                                        Iterator<OperateLogDTO> iter = articles.iterator();
                                        OperateLogDTO user = null;
                                        while (iter.hasNext()) {
                                            user = iter.next();

                                %>
                                <tr id="user_<%=user.getId()%>">

                                    <td>
                                        <%=user.getId()%>
                                    </td>
                                    <td>
                                        <%= SiteHelper.getEmptyStr(user.getUserCpId())%>
                                    </td>
                                    <td>
                                        <%= user.getIp()%>
                                    </td>
                                    <td>
                                        <%= user.getInfo()%>
                                    </td>
                                    <td>
                                        <%= SiteHelper.getDefaultTimeFormat(user.getOperateDate())%>
                                    </td>
                                    <td>
                                        <%= user.getParam()!=null&&user.getParam().length()>50?user.getParam().substring(0,50):user.getParam()%>
                                    </td>

                                </tr>
                                <%
                                    }
                                } else {
                                %>
                                <tr>
                                    <td colspan="7">未找到数据</td>
                                </tr>
                                <% }%>
                                </tbody>
                            </table>
                            <div class="col-sm-10">

                                <div class="dataTables_paginate paging_simple_numbers" id="example1_paginate">
                                    <page:page totalSum="<%= pager.getTotal()%>"
                                               url="<%= query%>"
                                               pageNo="<%= pager.getPage()%>"
                                               pageSize="<%= pager.getPageSize()%>"></page:page>
                                </div>
                            </div>
                        </div>
                        <!-- /.box-body -->
                    </div>
                    <!-- /.box -->
                </div>
                <!-- /.col -->
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
    <%--<jsp:include page="foot.jsp"></jsp:include>--%>
</div>
<script src="<%= request.getAttribute("StaticHost") %>/js/jquery.dataTables.min.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/dataTables.bootstrap.min.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/jquery.slimscroll.min.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/fastclick.js"></script>
<script src="<%= request.getAttribute("StaticHost") %>/js/adminlte.min.js"></script>
<script>
    $(function () {
        var channelState = "<%= request.getParameter("t")!=null?request.getParameter("t"):"1"%>";
        $("#ddltype").val(channelState);
        $("#ddltype").change(function () {
            var uidStr = $("#txtPerson").val();
            if ($.trim(uidStr) != '') {
                uidStr = "&uid=" + uidStr;
            }
            window.location.href = "${pageContext.request.contextPath}/sys/log?t=" + $(this).val() + uidStr;
        })

        $("#btnSearch").on("click", function () {
            var uidStr = $("#txtPerson").val();
            if ($.trim(uidStr) != '') {
                uidStr = "&uid=" + uidStr;
            }
            window.location.href = "${pageContext.request.contextPath}/sys/log?t=" + $("#ddltype").val() + uidStr;
        });
    })
</script>
</body>
</html>

